import mutations from './mutations'
import { isIframeRoute } from '@/util/iframe'
import { originalThemeColor } from '@/mixins/color'

const state = {
  collapse: true,
  fullscreen: false,
  tabs: [
    {
      title: '工作台',
      path: '/',
      fullPath: '/',
      icon: 'el-icon-s-platform',
      name: 'Home',
      url: null,
      time: Date.now()
    }
  ],
  message: 0,
  theme: {
    name: '默认',
    value: 'default'
  },
  themeColor: originalThemeColor
}

export default {
  namespaced: true,
  state,
  mutations,
  getters: {
    urlTabs(state) {
      return state.tabs.filter(value => isIframeRoute(value.path) || value.url)
    }
  }
}
